package ph.gov.marikina.mcsmtms.constants;

public final class GlobalConstants {

	public static enum Roads {
		// 1 Bayan-Bayanan Avenue
		// 2 E. Rodriguez Avenue
		// 3 E. Santos Avenue
		// 4 J.P. Rizal Street
		// 5 J. Molina Street
		BAYAN_BAYANAN("BAYAN_AVE", "Bayan-Bayanan Avenue", "Bayan-Bayanan Ave."), E_RODRIGUEZ("EROD_AVE",
				"E. Rodriguez Avenue", "E. Rodriguez Ave."), E_SANTOS("ESANTOS_AVE", "E. Santos Avenue", "E. Santos Ave"), JP_RIZAL(
				"JPRIZAL_ST", "J.P. Rizal Street", "J.P. Rizal St."), J_MOLINA("JMOLINA_ST", "J. Molina Street", "J. Molina St.");

		private final String code; // code
		private final String description; // description
		private final String shortName; // description

		Roads(String code, String description) {
			this.code = code;
			this.description = description;
			this.shortName = description;
		}
		
		Roads(String code, String description, String shortName) {
			this.code = code;
			this.description = description;
			this.shortName = shortName;
		}
		
		public String getCode() {
			return code;
		}

		public String getDescription() {
			return description;
		}
		
		public String getShortName() {
			return shortName;
		}

		public static String getDescriptionByCode(String code) {
			for (Roads road : values()) {
				if (road.getCode().equals(code))
					return road.getDescription();
			}
			return null;
		}
		
		public static String getShortNameByCode(String code) {
			for (Roads road : values()) {
				if (road.getCode().equals(code))
					return road.getShortName();
			}
			return null;
		}
		
		public static String getCodeByDescription(String description) {
			for (Roads road : values()) {
				if (road.getDescription().equals(description))
					return road.getCode();
			}
			return null;
		}
	}

	public static enum SituationTypes {
		// 1 Accident
		// 2 Blocked/Closed Road
		// 3 Flood
		// 4 Road Works
		// 5 Poor Visibility
		ACCIDENT("ACCIDENT", "Accident"), BLOCKED("BLOCKED_ROAD", "Blocked/Closed Road"), FLOOD("FLOOD",
				"Flood"), ROAD_WORKS("ROAD_WORKS", "Road Works"), BAD_WEATHER("BAD_WEATHER",
				"Poor Visibility");

		private final String code; // code
		private final String description; // description

		SituationTypes(String code, String description) {
			this.code = code;
			this.description = description;
		}

		public String getCode() {
			return code;
		}

		public String getDescription() {
			return description;
		}

		public static String getDescriptionByCode(String code) {
			for (SituationTypes situationType : values()) {
				if (situationType.getCode().equals(code))
					return situationType.getDescription();
			}
			return null;
		}
	}

	public static enum TrafficConditionTypes {
		LIGHT("LIGHT", "Light"), NORMAL("NORMAL", "Normal"), HEAVY("HEAVY", "Heavy");

		private final String code; // code
		private final String description; // description

		TrafficConditionTypes(String code, String description) {
			this.code = code;
			this.description = description;
		}

		public String getCode() {
			return code;
		}

		public String getDescription() {
			return description;
		}

		public static String getDescriptionByCode(String code) {
			for (TrafficConditionTypes trafficConditionType : values()) {
				if (trafficConditionType.getCode().equals(code))
					return trafficConditionType.getDescription();
			}
			return null;
		}
	}

	public static enum UserTypes {
		// 1 MMDA
		// 2 Web User
		// 3 Mobile User
		// 4 Anonymous Web User
		MMDA("MMDA", "MMDA"), 
		USER("USER", "User"), 
		SCOUT("SCOUT", "Scout"),
		BAYANAN_SCOUT("BAYANAN_SCOUT", "Bayan-Bayanan Ave. Scout"),
		EROD_SCOUT("EROD_SCOUT", "E. Rodriguez Ave. Scout"),
		ESANTOS_SCOUT("ESANTOS_SCOUT", "E. Santos Ave. Scout"),
		JMOLINA_SCOUT("JMOLINA_SCOUT", "J. Molina St. Scout"),
		JPRIZAL_SCOUT("JPRIZAL_SCOUT", "J.P. Rizal St. Scout"),
		BAYANAN_MMDA("BAYANAN_MMDA", "Bayan-Bayanan Ave. MMDA"),
		EROD_MMDA("EROD_MMDA", "E. Rodriguez Ave. MMDA"),
		ESANTOS_MMDA("ESANTOS_MMDA", "E. Santos Ave. MMDA"),
		JMOLINA_MMDA("JMOLINA_MMDA", "J. Molina St. MMDA"),
		JPRIZAL_MMDA("JPRIZAL_MMDA", "J.P. Rizal St. MMDA");

		private final String code; // code
		private final String description; // description

		UserTypes(String code, String description) {
			this.code = code;
			this.description = description;
		}

		public String getCode() {
			return code;
		}

		public String getDescription() {
			return description;
		}

		public static String getDescriptionByCode(String code) {
			for (UserTypes userType : values()) {
				if (userType.getCode().equals(code))
					return userType.getDescription();
			}
			return null;
		}
	}
	
	public static enum Direction {
		//A_TO_B
		//B_TO_A
		A_TO_B("A_TO_B", "Point A to point B"), B_TO_A("B_TO_A", "Point B to point A");

		private final String code; // code
		private final String description; // description

		Direction(String code, String description) {
			this.code = code;
			this.description = description;
		}

		public String getCode() {
			return code;
		}

		public String getDescription() {
			return description;
		}

		public static String getDescriptionByCode(String code) {
			for (Direction direction : values()) {
				if (direction.getCode().equals(code))
					return direction.getDescription();
			}
			return null;
		}
		
	}
	
	public static enum ReportSource {
		MMDA("MMDA", "MMDA"), MOBILE("MOBILE", "Mobile"), SCOUT("SCOUT", "Scout"), WEB("WEB", "Web");

		private final String code; // code
		private final String description; // description

		ReportSource(String code, String description) {
			this.code = code;
			this.description = description;
		}

		public String getCode() {
			return code;
		}

		public String getDescription() {
			return description;
		}

		public static String getDescriptionByCode(String code) {
			for (ReportSource reportSource : values()) {
				if (reportSource.getCode().equals(code))
					return reportSource.getDescription();
			}
			return null;
		}
		
	}
	
	public static enum Status {
		NEW("NEW", "New Situation Report"), VALIDATED("VALIDATED", "Validated Situation Report"), FOR_VALIDATION("FOR_VALIDATION", "For Validation Situation Report"), 
		REJECTED("REJECTED", "Rejected Report");

		private final String code; // code
		private final String description; // description

		Status(String code, String description) {
			this.code = code;
			this.description = description;
		}

		public String getCode() {
			return code;
		}

		public String getDescription() {
			return description;
		}

		public static String getDescriptionByCode(String code) {
			for (Status reportSource : values()) {
				if (reportSource.getCode().equals(code))
					return reportSource.getDescription();
			}
			return null;
		}
		
	}
	
	public static final int MAX_CREDIBILITY_RATING = 15;
	public static final int MIN_CREDIBILITY_RATING = -10;
	public static final int MIN_CREDIBLE_RATING = 10;
	public static final double WEIGHT_SCOUT = 0.35;
	public static final double WEIGHT_MOBILE_USERS = 0.25;
	public static final double WEIGHT_CREDIBLE_WEB_USERS = 0.25;
	public static final double WEIGHT_TOTAL_WEB_USERS = 0.10;
	public static final double WEIGHT_TRUST = 0.05;
	public static final String DEFAULT_TZ = "UTC";
	public static final String MANILA_TZ = "Asia/Manila";
	
}
